package tianqi.utils;

import java.text.NumberFormat;
import java.util.Date;
import java.util.UUID;

public class UuidUtil {

	public static int idnum = 1;
	/*
	 * 生成常用ID编码
	 */
	public synchronized static String generatorId()
	{
		if(idnum>=999)
		{
			idnum=1;
		}
		java.text.DateFormat format = new java.text.SimpleDateFormat("yyMMddHHmmss");
		NumberFormat nf = NumberFormat.getInstance();
		nf.setGroupingUsed(false);
		nf.setMaximumIntegerDigits(4);
		nf.setMinimumIntegerDigits(4);
        String datestr = format.format(new Date());
        return ("NL"+datestr+nf.format(idnum++));
	}

	public static String get32UUID() {
		String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
		return uuid;
	}

	public static void main(String[] args) {
		for (int i = 0; i < 30; i++) {
			System.out.println(get32UUID());
		}
		
	}
}
